package servlet;

import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import model.DeleteMasterImpl;
import model.PollUserImpl;
import bean.PollUser;
public class DeleteMasterServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5032791462526249675L;	
	
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doPost (request, response);
	} 
	
	public void doPost (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		response.setContentType("text/html");
		response.setCharacterEncoding("GBK");
		String username = request.getParameter("pmusername");
		System.out.println(username);
		
		PollUser user = new PollUser();
		user.setUsername(username);
		
		DeleteMasterImpl  dm= new DeleteMasterImpl();
		dm.deleteMaster(user);
		
		String forward;
		
		forward = "Masterlist.jsp";
		
		RequestDispatcher rd=request.getRequestDispatcher(forward);
		rd.forward(request, response);
	}
}
